﻿<Window x:Class="BizTalk_Benchmark_Wizard.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:BizTalk_Benchmark_Wizard"
        xmlns:c="clr-namespace:BizTalk_Benchmark_Wizard.Resources.Styles"
        xmlns:my1="clr-namespace:bLogical.GaugeControl;assembly=bLogical.GaugeControl"
        xmlns:dropShadow="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
        Title="BizTalk Benchmark Wizard" 
        Height="447" 
        Width="709" 
        ResizeMode="NoResize"
        Icon="Resources/Images/BBW_Logo.png"
        xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" 
        Loaded="Window_Loaded">
    <Window.Resources>
        <Style  TargetType="{x:Type TabControl}">
            <Setter Property="OverridesDefaultStyle" Value="True" />
            <Setter Property="SnapsToDevicePixels" Value="True" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid KeyboardNavigation.TabNavigation="Local">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <TabPanel Name="HeaderPanel"
                                        Grid.Row="0"
                                        Panel.ZIndex="1" 
                                        Margin="0,0,4,-1" 
                                        IsItemsHost="True"
                                        KeyboardNavigation.TabIndex="1"
                                        Background="Transparent" />
                            <Border Name="Border" 
                                    Grid.Row="1" 
                                    Margin="0,0,0,0"
			                        BorderBrush="Gainsboro"
			                        CornerRadius="5,5,5,5"
                                    KeyboardNavigation.TabNavigation="Local"
                                    KeyboardNavigation.DirectionalNavigation="Contained"
                                    KeyboardNavigation.TabIndex="2"
                                    BorderThickness="0,0,0,0"
			                        Background="{StaticResource BrushedMetalBackground}">

                                <ContentPresenter Name="PART_SelectedContentHost"
                                                  Margin="4"
                                                  ContentSource="SelectedContent" />
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Grid>

                            <Border Name="Border"
                                     Background="Transparent"
                                     BorderBrush="Transparent" 
                                     BorderThickness="1,1,1,1" 
                                     CornerRadius="6,6,0,0" >
                                <ContentPresenter x:Name="ContentSite"
                                                   VerticalAlignment="Center"
                                                   HorizontalAlignment="Center"
                                                   ContentSource="Header"
                                                   Margin="12,2,12,2"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type Label}">
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="FontFamily" Value="Calibri"/>
        </Style>
        
        <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBoxBase}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="MinWidth" Value="20"/>
            <Setter Property="MinHeight" Value="20"/>
            <Setter Property="AllowDrop" Value="true"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBoxBase}">
                        <Border Name="Border"
                                  CornerRadius="5" 
                                  Padding="2"
                                  Background="{StaticResource WindowBackgroundBrush}"
                                  BorderBrush="{StaticResource SolidBorderBrush}"
                                  BorderThickness="1" >
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}"/>
                                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBackgroundBrush}"/>
                                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="{x:Type local:MaskedTextBox}" TargetType="{x:Type local:MaskedTextBox}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="MinWidth" Value="20"/>
            <Setter Property="MinHeight" Value="20"/>
            <Setter Property="AllowDrop" Value="true"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBoxBase}">
                        <Border Name="Border"
                                  CornerRadius="5" 
                                  Padding="2"
                                  Background="{StaticResource WindowBackgroundBrush}"
                                  BorderBrush="{StaticResource SolidBorderBrush}"
                                  BorderThickness="1" >
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}"/>
                                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBackgroundBrush}"/>
                                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="RoundedPasswordBox" TargetType="{x:Type PasswordBox}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="MinWidth" Value="20"/>
            <Setter Property="MinHeight" Value="20"/>
            <Setter Property="AllowDrop" Value="true"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type PasswordBox}">
                        <Border Name="Border"
                                  CornerRadius="5" 
                                  Padding="2"
                                  Background="{StaticResource WindowBackgroundBrush}"
                                  BorderBrush="{StaticResource SolidBorderBrush}"
                                  BorderThickness="1" >
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}"/>
                                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBackgroundBrush}"/>
                                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Canvas>       
            <TabControl Height="430"
                        Name="tabControl1" 
                        Width="693"
                        Background="Transparent" 
                        Canvas.Top="-14"
                        Margin="5,0,0,0" TabStripPlacement="Bottom" SelectionChanged="tabControl1_SelectionChanged">
                <TabItem Header="" Name="tabWelcome">
                    <Grid Background="Transparent">
                        <Label Height="61" Margin="20,34,19,0" VerticalAlignment="Top" FontSize="30" FontWeight="Bold" FontFamily="Calibri">Welcome to BizTalk Benchmark Wizard</Label>

                        <Label Margin="40,80,19,129" Name="label2"  FontFamily="Calibri">
                            <TextBlock TextWrapping="Wrap">The purpose of this tool is to verify your BizTalk environment performs as expected. The typical use case where you would <LineBreak/>use the BizTalk Benchmark Wizard would be after BizTalk Server is installed and before deploying any solutions to the environment.<LineBreak/>
                                <LineBreak/>BizTalk Benchmark Wizard performs load to BizTalk Server in relation to a specific scenario. During the execution of the test, counter information is collected and benchmarked against collected statistics relevant to your BizTalk Server environment<LineBreak/>
                                After completion of the test, a result is presented showing whether or not your BizTalk investment is performing as you could expect.<LineBreak/>
                                <LineBreak/>The executed scenarios may or may not be relative to any realistic scenario, and is only intended for testing. The BizTalk Benchmark Wizard has been developed in relation to the <Bold><Italic>BizTalk Server 2009 Scale Out Testing Study</Italic></Bold>. More information about the study can be found <Hyperlink NavigateUri="http://msdn.microsoft.com/en-us/library/ee377068(BTS.10).aspx" RequestNavigate="Hyperlink_RequestNavigate" >here</Hyperlink>.</TextBlock>
                        </Label>

                    </Grid>
                </TabItem>
                <TabItem Header="" Name="tabScenario">
                    <Grid>
                        <Label Height="61" Margin="20,34,19,0" VerticalAlignment="Top" FontSize="30" FontWeight="Bold" FontFamily="Calibri">Scenarios</Label>

                        <Label Margin="40,75,19,129" FontFamily="Calibri">
                            <TextBlock TextWrapping="Wrap">
                                BizTalk Benchmark Wizard uses Microsoft LoadGen 2007 to generate message transmission loads to run performance and stress tests for Microsoft BizTalk Server applications. 
                                <LineBreak/>Depending on which scenario you select below, a different script will be executed. Microsoft LoadGen 2007 was installed together with BizTalk Benchmark Wizard, and can be used afterwards to continue analyzing your environment.
                            </TextBlock>
                        </Label>
                        <Canvas Margin="40,150" >
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation="Horizontal">
                                    <Label Canvas.Left="26" Canvas.Top="16" Height="28" Name="label1" Width="90">Select scenario:</Label>
                                    <ComboBox Template="{StaticResource ComboBoxTemplate}" Canvas.Left="121" Canvas.Top="16" Height="23" Name="cbScenario" Width="510" SelectionChanged="cbScenario_SelectionChanged" />
                                </StackPanel>
                                <StackPanel Height="10"/>
                                <GroupBox Header="Select an environment which, as close as possible, resembles your own" 
                                          x:Name="environmentsGroup" 
                                          Height="150" 
                                          Width="600" 
                                          Canvas.Left="25" 
                                          Canvas.Top="45">
                                    <Border Margin="0,0,0,0"
			                                BorderBrush="Gainsboro"
                                            CornerRadius="5,5,5,5"
                                            BorderThickness="1,1,1,1">
                                        <StackPanel Orientation="Vertical">
                                            <ListBox Name="environments" 
                                                    AllowDrop="False"
                                                    BorderBrush="{StaticResource BrushedMetalBackground}" 
                                                    Background="{StaticResource BrushedMetalBackground}"
                                                    ItemsSource="{Binding}" 
                                                     SelectionChanged="environments_SelectionChanged" 
                                                     MouseUp="environments_MouseUp" 
                                                     TabIndex="0" 
                                                     IsTabStop="True">
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <!--<TextBlock Text="{Binding Path=Name}" VerticalAlignment="Center" Width="200" FontWeight="Bold"/>
                                                            <StackPanel Width="20" Orientation="Horizontal"/>-->
                                                            <TextBlock Text="{Binding Path=Description}" VerticalAlignment="Center" Width="580"/>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </StackPanel>
                                    </Border>
                                </GroupBox>
                            </StackPanel>
                        </Canvas>
                    </Grid>
                </TabItem>
                <TabItem Header="" Name="tabPrerequsites" >
                    <Grid>
                        <Label Height="61" Margin="20,34,19,0" VerticalAlignment="Top" FontSize="30" FontWeight="Bold" FontFamily="Calibri">Prerequsites</Label>
                        <StackPanel Orientation="Vertical" Margin="40,80" >
                            <StackPanel Orientation="Horizontal">
                                <Image Name="picInstallCollectorSet" Height="40" Source="Resources/Images/unknown.png"/>
                                <StackPanel Orientation="Horizontal">
                                    <Label FontFamily="Calibri" MaxWidth="550" Width="490">
                                        <TextBlock TextWrapping="Wrap"><Bold>Optional</Bold> - Create Data Collector Sets for further analyzes after the completion of the test.</TextBlock>
                                    </Label>
                                    <Button Height="23" Style="{DynamicResource RoundedButton}" IsEnabled="False" HorizontalAlignment="Right" Name="btnCreateCollectors" VerticalAlignment="Center" Width="75" Click="btnCreateCollectors_Click">Create</Button>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Height="10"/>
                            <StackPanel Orientation="Horizontal">
                                <Image Name="picInstalledScenario" Height="40" Source="Resources/Images/unknown.png"/>
                                <StackPanel Orientation="Horizontal">
                                    <Label FontFamily="Calibri" MaxWidth="550" Width="450">
                                        <TextBlock TextWrapping="Wrap"><Bold>Mandatory</Bold> - Install testing scenario on all BizTalk servers.</TextBlock>
                                    </Label>
                                    <Label Name="lblInstalledScenarioManual" FontFamily="Calibri">
                                        <TextBlock TextWrapping="Wrap"><Bold>This is a manual step.</Bold></TextBlock>
                                    </Label>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Height="10"/>
                            <StackPanel Orientation="Vertical" Name="WaitPanel">
                                <TextBlock Name="lblWait" FontSize="20" HorizontalAlignment="Center" FontWeight="Bold" Text="Please wait while checking for installed components..."/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Name="InstallInstructions" Visibility="Collapsed">
                                <Label Name="lblInstallInstructionsTitle" FontWeight="Bold">Installation instructions:</Label>
                                <Label Name="lblInstallInstructions">
                                    <TextBlock >1. Copy the BizTalk folder located in the [InstallDir]\Artefacts folder to your BizTalk servers<LineBreak/>
                                                                    2. Run the InstallHosts.vbs script on ONE of the BizTalk servers, to create hosts, host instances and adapter handlers.<LineBreak/>
                                                                    3. Import the BizTalk Benchmark Wizard.msi on ONE of the BizTalk Servers<LineBreak/>
                                                                    4. Install the BizTalk Benchmark Wizard.msi on ALL BizTalk servers in order to add the assemblies to GAC.<LineBreak/>
                                                                    5. Restart the BBW* hosts and stop all other host instances<LineBreak/>
                                                                    6. Run this wizard again<LineBreak/><LineBreak/>It is strongly recommened not to run the wizard from any of the BizTalk servers.
                                    </TextBlock>


                                </Label>
                            </StackPanel>

                        </StackPanel>
                    </Grid>
                </TabItem>              
                <TabItem Header="" Name="tabScenarioDescription">
                    <Grid>
                        <Label Height="61" Margin="20,34,19,0" VerticalAlignment="Top" FontSize="30" FontWeight="Bold" FontFamily="Calibri">
                            <TextBlock Name="ScenarioName" TextWrapping="Wrap">Scenario</TextBlock>
                        </Label>

                        <Label FontFamily="Calibri" Margin="0,80,19,129">
                            <TextBlock Name="ScenarioDescription"  TextWrapping="Wrap">...</TextBlock>
                        </Label>

                        <Canvas>
                            <Image Name="ScenairoPicture1" Source="Resources/Images/scenario1.png" Width="400" Canvas.Top="217" Canvas.Left="36.654" Height="151" Visibility="Visible"/>
                            <Image Name="ScenairoPicture2" Source="Resources/Images/scenario2.png" Width="400" Canvas.Top="217" Canvas.Left="36.654" Height="151" Visibility="Hidden"/>
                        </Canvas>
                    </Grid>
                </TabItem>
                <TabItem Header="" Name="tabSelectHosts">
                    <Grid>
                        <Label Height="61" Margin="20,34,19,0" VerticalAlignment="Top" FontSize="30" FontWeight="Bold" FontFamily="Calibri">
                            <TextBlock TextWrapping="Wrap">Select Receive and Send hosts</TextBlock>
                        </Label>
                        <Label Margin="40,75,19,129" FontFamily="Calibri">
                            <TextBlock TextWrapping="Wrap">
                                While running the test BizTalk Benchmark Wizard will collect Perfmon Counter data for test evaluation.<LineBreak/>This data is collected from all BizTalk servers. Please provide information about which servers are running the hosts.
                            </TextBlock>
                        </Label>
                        <GroupBox Header="Hosts" x:Name="tbReceivePorts" Margin="68,158,86,107.5">
                            <Border Margin="0,0,0,0"
			                        BorderBrush="Gainsboro"
                                    CornerRadius="5,5,5,5"
                                    BorderThickness="1,1,1,1">
                                <StackPanel Orientation="Vertical">
                                    <ListBox Name="lstHosts" 
                                        AllowDrop="False"
                                        BorderBrush="{StaticResource BrushedMetalBackground}" 
                                        Background="{StaticResource BrushedMetalBackground}"
                                        ItemsSource="{Binding}">
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <TextBlock Text="{Binding Path=HostDescription}" VerticalAlignment="Center" Width="260" FontWeight="Bold"  Height="25"/>
                                                    <ComboBox Template="{StaticResource ComboBoxTemplate}"
                                                              ItemsSource="{Binding Path=Servers, Mode=TwoWay}" 
                                                              SelectedIndex="0" 
                                                              SelectedItem="{Binding Path=SelectedHost, Mode=TwoWay}"
                                                              Width="250"
                                                              Height="20"/>
                                                </StackPanel>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>

                                </StackPanel>
                            </Border>
                        </GroupBox>
                        <StackPanel Height="60" Orientation="Horizontal"/>

                    </Grid>
                </TabItem>
                <TabItem Header="" Name="tabPrepare">
                    <Grid>
                        <Label Height="61" Margin="20,34,19,0" VerticalAlignment="Top" FontSize="30" FontWeight="Bold" FontFamily="Calibri">Prepare</Label>
                        <StackPanel Orientation="Vertical" Margin="40,80,20,61" >
                            <Label FontFamily="Calibri">
                                <TextBlock Name="TESTLABEL" TextWrapping="Wrap">In order to create a comparable result, please terminate all suspended instances, and stop all Host Instances <LineBreak/>not running the WCF-NetTcp adapter. Make sure to have at least one Host Instance with tracking enabled.</TextBlock>
                            </Label>
                            <Label VerticalAlignment="Top" FontSize="25" FontWeight="Bold" FontFamily="Calibri">Start the Indigo Service</Label>

                            <Label FontFamily="Calibri">
                                <TextBlock TextWrapping="Wrap">Before starting the tests, The Indigo Service host console application need to be started. This service is used by 
                                <LineBreak/>the BizTalk scenario, and would benefit being started on a separate server.<LineBreak/>    
                                <LineBreak/>1. Copy the IndigoService folder located in the BizTalk Benchmark Wizard install folder to a separate server. 
                                <LineBreak/>2. Start the Indigo Service by double-click the  <Bold>StartIndigoService.bat</Bold> file.
                                <LineBreak/>3. Enter the name of the server where you have started the Indigo Service in the text box below.
                                <LineBreak/>4. Test the Indigo Service by clicking the "Test Indigo service" button.
                                </TextBlock>
                            </Label>
                            <StackPanel Height="5"/>
                            <StackPanel Orientation="Horizontal">
                                <Image Name="picServiceIsRunning" Height="40" Source="Resources/Images/unknown.png"/>
                                <StackPanel Orientation="Horizontal">
                                    <Label FontFamily="Calibri" Height="23" >
                                        <TextBlock TextWrapping="Wrap"><Bold>Server name:</Bold></TextBlock>
                                    </Label>
                                    <TextBox Name="txtIndigoServiceServer" Width="280" Height="23" VerticalAlignment="Center" Text="" ></TextBox>
                                    <StackPanel Width="80"/>
                                    <Button Height="25" Style="{DynamicResource RoundedButton}" HorizontalAlignment="Right" Name="btnTestService" VerticalAlignment="Center" Width="130" Click="btnTestService_Click">Test the Indigo Service</Button>
                                </StackPanel>

                            </StackPanel>
                            <StackPanel Height="0"/>
                            <StackPanel Orientation="Horizontal">
                                <StackPanel Orientation="Horizontal" Width="115"/>
                                <CheckBox Name="chbStartCollectorSets" VerticalAlignment="Center" IsChecked="False" >Start Perfmon collector sets</CheckBox>
                                <StackPanel Width="10"/> 
                                <TextBlock VerticalAlignment="Center">Test duration (minutes):</TextBlock>
                                <local:MaskedTextBox Mask="000" x:Name="txtTestDuration" Width="50" TextAlignment="Center">30</local:MaskedTextBox>
                            </StackPanel>
                        </StackPanel>
                    </Grid>
                </TabItem>
                <TabItem Header="" Name="tabInitiating" >
                    <Grid>
                        <Label Height="61" Margin="20,34,19,0" VerticalAlignment="Top" FontSize="30" FontWeight="Bold" FontFamily="Calibri">Please wait while initiating test runs</Label>
                        <StackPanel Orientation="Vertical" Margin="40,90" Height="250">

                            <StackPanel Orientation="Horizontal">
                                <Image Name="picUpdateSendportUri" Height="40" Source="Resources/Images/gear_run.png"/>
                                <StackPanel Orientation="Horizontal">
                                    <Label FontFamily="Calibri" MaxWidth="550" Width="500" VerticalAlignment="Center">
                                        <TextBlock TextWrapping="Wrap"><Bold>Update Uri for BizTalk send port (Indigo Service Uri)</Bold></TextBlock>
                                    </Label>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Height="5" />
                            <StackPanel Orientation="Horizontal">
                                <Image Name="picStartBizTalkArtefacts" Height="40" Source="Resources/Images/gear_pause.png"/>
                                <StackPanel Orientation="Horizontal">
                                    <Label FontFamily="Calibri" MaxWidth="550" Width="500" VerticalAlignment="Center">
                                        <TextBlock TextWrapping="Wrap"><Bold>Start BizTalk ports and orchestrations</Bold></TextBlock>
                                    </Label>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Height="5" />
                            <StackPanel Orientation="Horizontal">
                                <Image Name="picStartCollectorSets" Height="40" Source="Resources/Images/gear_pause.png"/>
                                <StackPanel Orientation="Horizontal">
                                    <Label FontFamily="Calibri" MaxWidth="550" Width="500" VerticalAlignment="Center">
                                        <TextBlock TextWrapping="Wrap"><Bold>Start Perfmon collector sets </Bold> (this might take a while)</TextBlock>
                                    </Label>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Height="5" />
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation="Horizontal">
                                    <Image Name="picInitPerfCounters" Height="40" Source="Resources/Images/gear_pause.png"/>
                                    <StackPanel Orientation="Horizontal">
                                        <Label FontFamily="Calibri" MaxWidth="550" Width="500" VerticalAlignment="Center">
                                            <TextBlock TextWrapping="Wrap"><Bold>Initiate Perfmon counters</Bold></TextBlock>
                                        </Label>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Height="5" />
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation="Horizontal">
                                    <Image Name="picStartLoadgen" Height="40" Source="Resources/Images/gear_pause.png"/>
                                    <StackPanel Orientation="Horizontal">
                                        <Label FontFamily="Calibri" MaxWidth="550" Width="500" VerticalAlignment="Center">
                                            <TextBlock TextWrapping="Wrap"><Bold>Start LoadGen client</Bold></TextBlock>
                                        </Label>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>

                        </StackPanel>

                    </Grid>
                </TabItem>
                <TabItem Header="" Name="tabRun">
                    <Canvas>
                        <Expander Name="CPUGaugeExpander" Header="View CPU Counters" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed" MaxHeight="250" >
                            <StackPanel Orientation="Horizontal"  >
                                <StackPanel Width="20"/>
                                <my1:GaugeControl Name="CPUGauge1" Caption="Avg CPU Receive"></my1:GaugeControl>
                                <StackPanel Width="30"/>
                                <my1:GaugeControl Name="CPUGauge2" Caption="Avg CPU Send" ></my1:GaugeControl>
                                <StackPanel Width="30"/>
                                <my1:GaugeControl Name="CPUGauge3" Caption="Avg CPU SQL"></my1:GaugeControl>
                            </StackPanel>
                        </Expander>
                        <StackPanel Orientation="Vertical" Margin="45,20">
                            
                            <StackPanel Orientation="Horizontal" Margin="0,10" HorizontalAlignment="Center">
                                <my1:GaugeControl Name="ReceivedGauge" Caption="Avg Received msgs/sec" ></my1:GaugeControl>
                                <StackPanel Width="30"/>
                                <my1:GaugeControl Name="ProcessedGauge" Caption="Avg Processed msgs/sec"></my1:GaugeControl>
                            </StackPanel>
                            <ProgressBar Name="Progress" Width="580" Foreground="Blue"  Value="{Binding ProcessValue}" Height="20" Minimum="0" Maximum="100" />
                            <TextBlock Name="lblTestTime" FontWeight="Bold" Text="Total test duration: 10 minutes" TextAlignment="Center" Height="20.01" Canvas.Left="80" Canvas.Top="304" Width="579.768" />
                            <TextBlock Name="lblWarmUp" FontWeight="Bold" Text="Currently warming up..." TextAlignment="Center" Height="20.01" Canvas.Left="80" Canvas.Top="320" Width="579.768" />

                        </StackPanel>
                    </Canvas>
                </TabItem>
                <TabItem Header="" Name="tabAnalyze">
                    <Grid>
                        <StackPanel Orientation="Vertical" Margin="20">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                <Image Name="picSucess" Source="Resources/Images/failed.png" Width="100" Height="100"/>
                                <Label FontSize="42" FontWeight="Bold" VerticalAlignment="Center">
                                    <TextBlock Name="lblSucess" Text="Failed!"/>
                                </Label>
                            </StackPanel>
                            
                            <StackPanel HorizontalAlignment="Center">
                                <my:DataGrid Name="ResultGrid" 
                                     ItemsSource="{Binding}" 
                                     AutoGenerateColumns="False" 
                                     Height="170" 
                                     Width="524" 
                                     Canvas.Left="25" 
                                     Canvas.Top="45">
                                    <my:DataGrid.Columns>
                                        <my:DataGridTextColumn Header="Counter"  Binding="{Binding CounterName}" Width="230"/>
                                        <my:DataGridTextColumn Header="Test Value"  Binding="{Binding TestValue}" Width="100"/>
                                        <my:DataGridTextColumn Header="KPI"  Binding="{Binding Kpi}"  Width="100"/>
                                        <my:DataGridTextColumn Header="Status"  Binding="{Binding Status}"  Width="70"/>
                                    </my:DataGrid.Columns>
                                </my:DataGrid>
                            </StackPanel>
                            <StackPanel HorizontalAlignment="Center" Width="530">
                                <Label>
                                    <TextBlock Name="lblResultDescription" TextWrapping="Wrap">
                                        <LineBreak/> The test did not complete with expected results. To further analyze the environment we recommend you to study the Data Collector Sets created using the <Hyperlink NavigateUri="http://www.codeplex.com/PAL" RequestNavigate="Hyperlink_RequestNavigate" >Performance Analysis of Logs (PAL) tool</Hyperlink>.
                                    </TextBlock>
                                </Label>
                            </StackPanel>
                        </StackPanel>
                        <Canvas>
                            <TextBlock Canvas.Left="195" Canvas.Top="363" Width="87.5">
                                <Hyperlink NavigateUri="http://blogical.se/bbw/" RequestNavigate="Hyperlink_RequestNavigate" >Show High Scores</Hyperlink>
                            </TextBlock>
                            <Button Height="23" Style="{DynamicResource RoundedButton}" HorizontalAlignment="Right" Name="btnOpenSubmitHighScore" VerticalAlignment="Bottom" Width="106.25" Canvas.Left="292.5" Canvas.Top="357" Click="btnOpenSubmitHighScore_Click">Submit High Score</Button>
                            <Button Height="23" Style="{DynamicResource RoundedButton}" HorizontalAlignment="Right" Name="btnGenerateReport" VerticalAlignment="Bottom" Width="73.75" Click="btnGenerateReport_Click" Canvas.Left="405" Canvas.Top="357">Report</Button>
                            <Button Height="23" Style="{DynamicResource RoundedButton}" HorizontalAlignment="Right" Name="btnReRunTest" VerticalAlignment="Bottom" Width="73.75" Canvas.Left="492.5" Canvas.Top="357" Click="btnReRunTest_Click">Re-Run</Button>
                        </Canvas>
                    </Grid>
                </TabItem>

            </TabControl>
            <StackPanel Orientation="Vertical" Canvas.Left="30" Canvas.Top="370">
                <TextBlock Name="lblHomeUri">
                     <Hyperlink NavigateUri="http://bbw.codeplex.com" RequestNavigate="Hyperlink_RequestNavigate" >http://bbw.codeplex.com</Hyperlink>
                </TextBlock>
                <TextBlock Name="lblVersion" Text="Version:1.0.0.0"/>
            </StackPanel>
            <Button Canvas.Left="501" Canvas.Top="365" Height="23" Name="btnBack" Width="74" Click="btnBack_Click" Style="{DynamicResource RoundedButton1}" Visibility="Hidden">Back</Button>
            <Button Canvas.Left="581" Canvas.Top="365" Height="23" Name="btnNext" Width="74" Click="btnNext_Click" Style="{DynamicResource RoundedButton}" >Next</Button>
        </Canvas>

        <Popup x:Name="PopupLogin" 
               AllowsTransparency="True"
               IsOpen="False"
               Width="400"
               Height="210"
               Placement="Center" PopupAnimation="Fade" Closed="PopupLogin_Closed">

            <Grid>
                <dropShadow:SystemDropShadowChrome CornerRadius="3,13,3,13" Color="#71000000">
                    <Grid x:Name="MyElement" />
                </dropShadow:SystemDropShadowChrome>

                <Grid>
                    <Border Margin="0,0,5,5"
			                BorderBrush="Gainsboro"
			                CornerRadius="5,5,5,5"
			                BorderThickness="1,1,1,1"
			                Background="{StaticResource BrushedMetalBackground}"/>

                    <StackPanel Orientation="Vertical" Width="365" Margin="0,25">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock><Bold>Please enter the name of the server on which the management<LineBreak/>
                                database is physically stored.</Bold><LineBreak/></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" Width="139.944">BizTalk Database Server:</Label>
                            <TextBox x:Name="txtServer1" Height="23" Width="215.557" VerticalAlignment="Top" TextAlignment="Right"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" Width="139.944">Management Database:</Label>
                            <TextBox x:Name="txtMgmtDb1" Height="23" TextAlignment="Right" VerticalAlignment="Top" Width="215.557">BizTalkMgmtDb</TextBox><StackPanel Width="5"/>
                            
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Width="140"/>
                            <CheckBox Name="chbCheckPrerequsites" VerticalAlignment="Center" IsChecked="True" >Check Prerequsites</CheckBox>
                        </StackPanel>
                        <StackPanel Height="15"/>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
                            <Button Height="23" Style="{DynamicResource RoundedButton}" Name="btnOk1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="75.263" Click="btnOk_Click">Ok</Button>
                            <StackPanel Width="5"/>
                            <Button Height="23" Style="{DynamicResource RoundedButton}" HorizontalAlignment="Right" Name="btnCancel1" VerticalAlignment="Bottom" Width="75" Click="btnCancel_Click">Cancel</Button>
                            
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </Grid>
        </Popup>
        <Popup x:Name="PopupException" 
               AllowsTransparency="True"
               IsOpen="False"
               Width="400"
               Height="200"
               Placement="Center" PopupAnimation="Fade">

            <Grid>
                <dropShadow:SystemDropShadowChrome CornerRadius="3,13,3,13" Color="#71000000">
                    <Grid x:Name="MyExceptionElement" />
                </dropShadow:SystemDropShadowChrome>

                <Grid>
                    <Border Margin="0,0,5,5"
			                    BorderBrush="Gainsboro"
			                    CornerRadius="5,5,5,5"
			                    BorderThickness="1,1,1,1"
			                    Background="{StaticResource BrushedMetalBackground}"/>

                    <StackPanel Orientation="Vertical"
                                    HorizontalAlignment="Left" 
                                    VerticalAlignment="Top"
                                    Width="380"
                                    Height="140"
                                    Margin="10"
                                    >
                        <StackPanel Orientation="Horizontal">
                            <Image Height="50" 
                                       Width="50" 
                                       Name="image1" 
                                       Stretch="Fill"  
                                       Source="Resources/Images/cross.png"/>
                            <TextBlock Text=" "/>
                            <TextBlock Text="An error has occured." FontSize="15" VerticalAlignment="Center"/>
                        </StackPanel>
                    </StackPanel>
                    <TextBox Margin="10,60,10,45" 
                             Name="txtException" 
                             ScrollViewer.VerticalScrollBarVisibility="Auto"
                             TextWrapping="Wrap"/>
                    <Button Height="23" Margin="162,0,162,15" Name="btnExceptionOk" Style="{DynamicResource RoundedButton}" VerticalAlignment="Bottom" Click="btnExceptionOk_Click">Ok</Button>
                </Grid>
            </Grid>
        </Popup>
        <Popup x:Name="PopupUpdateManualy" 
               AllowsTransparency="True"
               IsOpen="False"
               Width="490"
               Height="310"
               Placement="Center" PopupAnimation="Fade">

            <Grid>
                <dropShadow:SystemDropShadowChrome CornerRadius="3,13,3,13" Color="#71000000">
                    <Grid/>
                </dropShadow:SystemDropShadowChrome>

                <Grid>
                    <Border Margin="0,0,5,5"
			                BorderBrush="Gainsboro"
			                CornerRadius="5,5,5,5"
			                BorderThickness="1,1,1,1"
			                Background="{StaticResource BrushedMetalBackground}"/>

                    <StackPanel Orientation="Vertical" Width="460" Margin="0,25">
                        <StackPanel Orientation="Horizontal">
                            <Image Name="picStartManuallyedScenario" VerticalAlignment="Center" Height="40" Source="Resources/Images/gear_information.png"/>
                            <Label VerticalAlignment="Center" FontSize="18" FontWeight="Bold" FontFamily="Calibri">Unable to commit changes to BizTalk</Label>

                        </StackPanel>
                        <TextBlock  TextWrapping="Wrap"><LineBreak/>
                                The application is not able to commit changes to BizTalk. This might be because the BizTalk run-time assemblies are not installed on this machine.<LineBreak/>
                                To resolve this, you will manually have to make these changes using the BizTalk Administration Console.<LineBreak/><LineBreak/>
                                <Bold>1. Start the BizTalk Application called BizTalk Benchmark Wizard.<LineBreak/>
                                2. Copy the Uri from the textbox below, and use it to update the Send Port Uri.<LineBreak/>
                                3. Click "Done" to start the tests.</Bold>
                        </TextBlock>
                        <StackPanel Height="20"/>
                        <StackPanel Orientation="Horizontal">
                            <Label Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" Width="105">New Send Port Uri:</Label>
                            <TextBox x:Name="txtUri" Height="23" TextAlignment="Right" VerticalAlignment="Top" Width="320"></TextBox>
                        </StackPanel>
                        <StackPanel Height="10"/>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Width="270"/>
                            <Button Height="23" Style="{DynamicResource RoundedButton}" Name="btnDone" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75.263" Click="btnDone_Click">Done</Button>
                            <StackPanel Width="5"/>
                            <Button Height="23" Style="{DynamicResource RoundedButton}" Name="btnCancel" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75.263" Click="btnCancel_Click">Close</Button>
                        </StackPanel>
                    </StackPanel>


                </Grid>
            </Grid>
        </Popup>       
        <Popup x:Name="PopupSubmitHighScore" 
               AllowsTransparency="True"
               IsOpen="False"
               Width="490"
               Height="300"
               Placement="Center">
            <Grid>
                <dropShadow:SystemDropShadowChrome CornerRadius="3,13,3,13" Color="#71000000">
                    <Grid/>
                </dropShadow:SystemDropShadowChrome>
                <Grid>
                    <Border Margin="0,0,5,5"
			                BorderBrush="Gainsboro"
			                CornerRadius="5,5,5,5"
			                BorderThickness="1,1,1,1"
			                Background="{StaticResource BrushedMetalBackground}"/>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Margin="20,20"  FontSize="20" FontWeight="Bold" FontFamily="Calibri">Submit High Score</TextBlock>
                        <TextBlock HorizontalAlignment="Center">Please provide some information about your BizTalk environment below.</TextBlock>
                        <StackPanel Height="5"/> 
                        <GroupBox Header="Configuration" Width="400" Height="150" Name="groupBox1">
                            <Grid>
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <Label Width="190">Name (three letters):</Label>
                                            <local:MaskedTextBox FontWeight="Bold" Mask="A.A.A" x:Name="txtInitials" Height="25" Width="50" TextAlignment="Center"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Width="190">Number of CPU on each BTS server:</Label>
                                        <local:MaskedTextBox Mask="00" FontWeight="Bold" x:Name="txtNoOfCpu" Width="35" TextAlignment="Center"/> 
                                        <StackPanel Width="10"/>
                                        <ComboBox Name="cbhCores" SelectedIndex="0" Width="145" Template="{StaticResource ComboBoxTemplate}">
                                            <ComboBoxItem Name="cbi1">Single Core</ComboBoxItem>
                                            <ComboBoxItem Name="cbi2">Dual Core</ComboBoxItem>
                                            <ComboBoxItem Name="cbi3">Quad Core</ComboBoxItem>
                                        </ComboBox>
                                        <!--<CheckBox Name="cnbIsQuad" IsChecked="False" VerticalAlignment="Center" >Quad core</CheckBox>
                                        <StackPanel Width="10"/>
                                        <CheckBox Name="cnbIsDual" IsChecked="False" VerticalAlignment="Center">Dual core</CheckBox>-->
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Width="190">CPU Ghz:</Label>
                                        <local:MaskedTextBox Mask="0.0" FontWeight="Bold" x:Name="txtCpuGhz" Width="35" TextAlignment="Center"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Width="190">RAM GB:</Label>
                                        <local:MaskedTextBox Mask="000" FontWeight="Bold" x:Name="txtRamGb" Width="35" TextAlignment="Center"/>
                                    </StackPanel>
                                </StackPanel>
                        </Grid>
                        </GroupBox>
                        <StackPanel Height="10"/>
                        <Button Height="23" Style="{DynamicResource RoundedButton}" Name="btnSubmitHighScore" HorizontalAlignment="Center" Width="75.263" Click="btnSubmitHighScore_Click">Submit</Button>
                    </StackPanel>
                </Grid>
            </Grid>
        </Popup>
    </Grid>
</Window>
